package com.miszczu.bo;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.miszczu.dao.SubjectsDao;
import com.miszczu.model.Subjects;

@Service
public class SubjectsBoImpl implements SubjectsBo {

	@Autowired
	SubjectsDao subjectsDao;
	
	public void save(Subjects subject) {
		
		subjectsDao.save(subject);

	}

	public List<Subjects> getAllSubjects() {

		return subjectsDao.getAllSubjects();
		
	}

	@Transactional
	public void delete(Integer id) {
		
		Subjects subject = subjectsDao.getOne(id);
		subjectsDao.delete(subject);
		
	}

	public Subjects getOne(Integer id) {

		return subjectsDao.getOne(id);
	}

	public void update(Subjects subject) {
		
		subjectsDao.update(subject);
		
	}

}
